package ru.rchervot.sanasar.client.rpc;

import ru.rchervot.sanasar.client.model.Query;

import com.google.gwt.user.client.rpc.IsSerializable;

public class SaveQuery extends Action implements IsSerializable {
	private Query query;
		
	public SaveQuery() {} // for serialization
	
	public SaveQuery(Query query) {
		this.query = query;
	}

	public Query getQuery() {
		return query;
	}
	
	@Override
	public boolean equals(Object o) {
		if (o == null) return false;

		if (! (o instanceof Query)) return false;

		SaveQuery to = (SaveQuery) o;

		return (query == null
				? to.getQuery() == null
						: query.equals(to.getQuery()));
	}

	@Override
	public int hashCode() {
		int result = 17;
		result = 37 * result
		+ (query == null ? 0 : query.hashCode());
		
		return result;
	}

}